<template>
	<view>
		<view class="lc-list" v-for="(item,index) in list">
			<view class="lc-con">
				<view class="lc-name">{{item.name}}</view>
				<view class="lc-time">{{item.updatetime}}更新</view>
			</view>
			<view class="lc-edit">
				<image :src="baseurl+'/imgs/ww1.png'" mode="widthFix" @click="edit(item.id)"></image>
				<image :src="baseurl+'/imgs/ww2.png'" mode="widthFix" @click="del(item.id)"></image>
			</view>
		</view>
		<view class="lc-add" @click="add">+添加简历</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				app: getApp().globalData,
				baseurl: getApp().globalData.baseurl,
				page: 1,
				list: []
			}
		},
		onShow() {
			this.page = 1
			this.list = []
			this.getList()
		},
		methods: {
			getList() {
				this.app.post('/api/wanlshop/user/workvitat', {
					page: this.page,
				}).then(res => {
					console.log(res)
					this.list = this.list.concat(res.list.data)
				})
			},
			edit(id) {
				uni.navigateTo({
					url: '/pages/lc/edit/edit?id=' + id
				})
			},
			del(id){
				this.app.post('/api/wanlshop/user/delworkvitat', {
					id: id,
				}).then(res => {
					console.log(res)
					uni.showToast({
						title: '删除成功',
						icon: "none"
					})
					setTimeout(()=>{
						this.page = 1
						this.list = []
						this.getList()
					},1500)
				})
			},
			add() {
				uni.navigateTo({
					url: '/pages/lc/add/add'
				})
			}
		},
		onReachBottom() {
			this.page += 1;
			this.getList();
		},
	}
</script>

<style lang="scss">
	.lc-list {
		width: 690rpx;
		padding: 30rpx 0;
		margin-top: 30rpx;
		margin-left: 30rpx;
		background-color: #FFFFFF;
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-radius: 20rpx;

		.lc-con {
			margin-left: 30rpx;

			.lc-name {
				font-size: 30rpx;
				color: #333333;
			}

			.lc-time {
				font-size: 24rpx;
				color: #999999;
				margin-top: 10rpx;
			}
		}

		.lc-edit {
			display: flex;
			margin-right: 30rpx;

			image {
				width: 40rpx;
				height: 40rpx;
				margin-left: 36rpx;
			}
		}
	}

	.lc-add {
		width: 690rpx;
		height: 82rpx;
		position: fixed;
		bottom: 30rpx;
		border-radius: 16rpx;
		background: rgba(132, 189, 0, 0.1);
		font-size: 30rpx;
		color: #84BD00;
		display: flex;
		justify-content: center;
		align-items: center;
		left: 30rpx;
	}
</style>